﻿using Xejen.Hosting;
using Xejen.Logger;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Communication.Socket.Client.TcpTest
{
    /// <summary>
    /// 表示适用于Winform的主机
    /// </summary>
    /// <creator>marc</creator>
    public class ConsoleAppHost : AppHostBase
    {
        /// <inheritdoc cref="ConsoleAppHost"/>
        /// <param name="args"><inheritdoc/></param>
        /// <param name="loggerManager"><inheritdoc/></param>
        public ConsoleAppHost(string[] args, ILoggerManager loggerManager) : base(args, loggerManager) { }

        /// <inheritdoc cref="ConsoleAppHost"/>
        /// <param name="configuration"><inheritdoc/></param>
        /// <param name="loggerManager"><inheritdoc/></param>
        public ConsoleAppHost(HostConfiguration configuration, ILoggerManager loggerManager) : base(configuration, loggerManager) { }

        /// <inheritdoc/>
        protected override void ConfigureJsonFiles(IConfigurationBuilder configuration)
        {
            base.ConfigureJsonFiles(configuration);
        }

        /// <inheritdoc/>
        protected override void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient<Service, Service>();
        }

        /// <inheritdoc/>
        public override void Run()
        {
            Logger.LogInformation($"应用程序启动完成");

            Console.WriteLine("Console App is running...");
            Console.ReadLine();
        }
    }
}
